<!DOCTYPE html>
<html lang="en">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  
  
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>
    Node安装与使用 |
    
    ZhiYinQ</title>
  
    <link rel="shortcut icon" href="/favicon.icon">
  
  <link rel="stylesheet" href="/css/style.css">
  
    <link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">
  
  <script src="/js/pace.min.js"></script>
</head>
</html>
<link href="https://cdn.staticfile.org/animate.css/3.7.2/animate.min.css" rel="stylesheet">

<body>
<main class="content">
  <section class="outer">
  <style>
.pag a:link, .pag a:visited {
    opacity: 1;
    -webkit-transition: all .15s linear;
    -moz-transition: all .15s linear;
    -o-transition: all .15s linear;
    -ms-transition: all .15s linear;
    transition: all .15s linear;
    color: #424242;
}
.pag a:hover {
    color: #ffffff;
}
.pag :hover {
    background-color: #127ea9;
}
</style>

<article id="post-node - 副本 (14)" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
  
  <div class="article-inner">
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      Node安装与使用
    </h1>
  
  




      </header>
    

    
      <div class="article-meta">
        <a href="/2019/08/10/node - 副本 (14)/" class="article-date">
  <time datetime="2019-08-10T08:21:54.000Z" itemprop="datePublished">2019-08-10</time>
</a>
        
  <div class="article-category">
    <a class="article-category-link" href="/categories/sdd/">sdd</a>
  </div>

		&emsp;<i class="fe fe-bar-chart"></i> <span class="post-count">247</span>字
		&emsp;<i class="fe fe-clock"></i> <span class="post-count">1</span>分钟
      </div>
    
    
      
    <div class="tocbot"></div>





    

    <div class="article-entry" itemprop="articleBody">
      
      
      
        <p>本文介绍了Node的安装，npm全局包位置和cache默认安装位置的更改，以及设置npm镜像源加快包下载。</p>
<a id="more"></a>
<h1 id="安装Node"><a href="#安装Node" class="headerlink" title="安装Node"></a>安装Node</h1><p><a href="https://nodejs.org/en/" target="_blank" rel="noopener">Node官网</a>下载Node<br>软件， 安装到指定位置，如<strong>D:\Program\nodejs</strong>，安装完成后环境变量<strong>PATH</strong> 内会有刚刚安装Node的安装目录<strong>D:\Program\nodejs</strong>。</p>
<h1 id="查看是否安装成功"><a href="#查看是否安装成功" class="headerlink" title="查看是否安装成功"></a>查看是否安装成功</h1><pre><code>node -v</code></pre><h1 id="npm配置修改"><a href="#npm配置修改" class="headerlink" title="npm配置修改"></a>npm配置修改</h1><h2 id="查看全局包位置"><a href="#查看全局包位置" class="headerlink" title="查看全局包位置"></a>查看全局包位置</h2><pre><code>npm root -g</code></pre><h2 id="查看prefix和cache路径配置信息"><a href="#查看prefix和cache路径配置信息" class="headerlink" title="查看prefix和cache路径配置信息"></a>查看prefix和cache路径配置信息</h2><pre><code>npm config get cache

npm config get prefix</code></pre><h2 id="查看npm配置信息"><a href="#查看npm配置信息" class="headerlink" title="查看npm配置信息"></a>查看npm配置信息</h2><pre><code>npm config list</code></pre><h2 id="修改全局包默认安装位置"><a href="#修改全局包默认安装位置" class="headerlink" title="修改全局包默认安装位置"></a>修改全局包默认安装位置</h2><p>D:\Program\nodejs目录下新建目录node_global， 执行以下命令：</p>
<pre><code>npm config set prefix &quot;D:\Program\nodejs\node_global&quot;</code></pre><blockquote>
<p>注意： 将<strong>D:\Program\nodejs\node_global</strong> 和 <strong>D:\Program\nodejs\node_modules</strong>目录添加入环境变量PATH内。</p>
</blockquote>
<h2 id="修改cache默认安装位置"><a href="#修改cache默认安装位置" class="headerlink" title="修改cache默认安装位置"></a>修改cache默认安装位置</h2><p><strong>D:\Program\nodejs</strong>目录下新建目录<strong>node_cache</strong>， 执行以下命令：</p>
<pre><code>npm config set cache  &quot;D:\Program\nodejs\node_cache&quot;</code></pre><h1 id="设置npm镜像源"><a href="#设置npm镜像源" class="headerlink" title="设置npm镜像源"></a>设置npm镜像源</h1><pre><code>npm config set registry https://registry.npm.taobao.org --global

npm config set disturl https://npm.taobao.org/dist --global</code></pre>
      
    </div>
    <footer class="article-footer">
      <!--<a data-url="https://github3982.github.io/2019/08/10/node - 副本 (14)/" data-id="ck1vxnbr1001siwq0zxs721zl"
         class="article-share-link">分享</a>“”“分享按钮”“”-->
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Node/">Node</a></li></ul>

	  
	<div style="text-align:center;color: #ccc;font-size:14px;">------------- 本文结束&nbsp;<i class="fe fe-smile"></i>&nbsp;感谢您的阅读 -------------</div>

    </footer>

  </div>

  
    
  <nav class="article-nav">
    
      <a href="/2019/08/10/node - 副本/" class="article-nav-link">
        <strong class="article-nav-caption">前一篇</strong>
        <div class="article-nav-title">
          
            Node安装与使用
          
        </div>
      </a>
    
    
      <a href="/2019/08/10/node - 副本 (2)/" class="article-nav-link">
        <strong class="article-nav-caption">后一篇</strong>
        <div class="article-nav-title">Node安装与使用</div>
      </a>
    
  </nav>


  

  
    

  

</article>



</section>
  <footer class="footer">
  <div class="outer">
    <div class="float-right">
      <ul class="list-inline">
  
    <!--<li><i class="fe fe-smile-alt"></i> <span id="busuanzi_value_site_uv"></span></li>-->
  
</ul>
    </div>
    <ul class="list-inline">
      <li>&copy; 2019 ZhiYinQ</li>
      <li>Powered by <a style="text-decoration: none !important;">Hexo</a></li>
      <li>Theme  <a style="text-decoration: none !important;">Ocean</a></li>
    </ul>
  </div>
</footer>

</main>

<aside class="sidebar sidebar-specter">
  
    <button class="navbar-toggle"></button>
<nav class="navbar">
  
    <div class="logo">
      <a href="/"><img id="img" src="/images/hexo.svg" alt="ZhiYinQ"></a>
    </div>
  
  <ul class="nav nav-main">
    
      <li class="nav-item">
        <a class="nav-item-link" href="/">主页</a>
      </li>
    
      <li class="nav-item">
        <a class="nav-item-link" href="/dynamic">动态</a>
      </li>
    
      <li class="nav-item">
        <a class="nav-item-link" href="/gallery">相册</a>
      </li>
    
      <li class="nav-item">
        <a class="nav-item-link" href="/share">分享</a>
      </li>
    
      <li class="nav-item">
        <a class="nav-item-link" href="/playlist">播放</a>
      </li>
    
      <li class="nav-item">
        <a class="nav-item-link" href="/about">关于</a>
      </li>
    
    <li class="nav-item">
      <a class="nav-item-link nav-item-search" title="搜索">
        <i class="fe fe-search"></i>
        搜索
      </a>
    </li>
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      <div class="totop" id="totop">
  <i class="fe fe-rocket"></i>
</div>
    </li>
    <li class="nav-item">
      
        <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
          <i class="fe fe-feed"></i>
        </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
  </aside>
  <script src="/js/jquery-2.0.3.min.js"></script>
<script src="/js/jquery.justifiedGallery.min.js"></script>
<script src="/js/lazyload.min.js"></script>
<script src="/js/busuanzi-2.3.pure.min.js"></script>

  <script src="/fancybox/jquery.fancybox.min.js"></script>



  <script src="/js/tocbot.min.js"></script>
  <script>
    // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
    tocbot.init({
      tocSelector: '.tocbot',
      contentSelector: '.article-entry',
      headingSelector: 'h1, h2, h3, h4, h5, h6',
      hasInnerContainers: true,
      scrollSmooth: true,
      positionFixedSelector: '.tocbot',
      positionFixedClass: 'is-position-fixed',
      fixedSidebarOffset: 'auto',
    });
  </script>



<script>
// 使用fancybox来显示post图片集(#andus-head-img为头像id)
$('img:not(#img)').each(function() {
  $(this).wrap('<a class="fancybox" data-fancybox="gallery" href="' + $(this).prop("src") + '"></a>'); 
})
</script>


<script src="/js/ocean.js"></script>

</body>
</html>
<script type="text/javascript" src="../dist/music.js"></script>
<script src="js/scrollReveal.js"></script>
</script>

	  <script>
			  $(function(){
    $('div img li').addClass('wdata-scroll-reveal');
});
</script>
<script>
window.scrollReveal = new scrollReveal();
//或者，elem 为动画元素的任何级别的父元素
window.scrollReveal2 = new scrollReveal({elem: document.getElementById('srcontainer')});
</script>	
